package com.sbtr.business.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.system.entity.HelpInfo;
import com.sbtr.business.system.dto.HelpInfoDto;

import com.sbtr.business.system.service.HelpInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.system.mapper.HelpInfoMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 帮助说明基本信息字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-07-18
 */
@Transactional
@Service
public class HelpInfoServiceImpl extends ServiceImpl<HelpInfoMapper,HelpInfo> implements HelpInfoService {

    @Autowired
    HelpInfoMapper helpInfoMapper;

    @Override
    public PageDto<HelpInfo> pageList(HelpInfoDto helpInfoDto) {

        IPage<HelpInfo> page = new Page<>();
        page.setSize(helpInfoDto.getPageSize());
        page.setCurrent(helpInfoDto.getPage());
        page = helpInfoMapper.selectPages(page, BeanUtil.beanToMap(helpInfoDto));
        PageDto<HelpInfo> r = PageDtoUtils.getPageDtoByIPage(page, HelpInfo.class);

        return r;
    }
}

